<template>
  <div>
    <el-table :data="transportTripsData">
      <el-table-column label="名称" prop="name"/>
      <el-table-column label="发车时间" prop="departureTime"/>
      <el-table-column label="所属线路id" prop="transportLineId">
        <template slot-scope="scope">
          <el-select v-model="scope.row.transportLineId" disabled>
            <el-option v-for="(item,index) in transportLineData" :label="item.name" :value="item.id"/>
          </el-select>
        </template>
      </el-table-column>

      <el-table-column label="周期">
        <template slot-scope="scope">
          <el-select v-model="scope.row.period" disabled>
            <el-option label="天" value="1"/>
            <el-option label="周" value="2"/>
            <el-option label="月" value="3"/>
          </el-select>
        </template>
      </el-table-column>

      <el-table-column label="状态">
        <template slot-scope="scope">
          <p v-if="scope.row.status==1">正常</p>
          <p v-if="scope.row.status==0">禁用</p>
        </template>
      </el-table-column>

      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button type="primary" size="mini">
            <router-link :to="'/transport-trips-driver-and-truck/'+scope.row.id">
              分配车辆和司机
            </router-link>
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import transportLine from '@/api/base/transportLine/index'
import transportTrips from '@/api/base/transportTrips/index'

export default {
  name: 'index',
  data() {
    return {
      transportLineData: [],
      transportTripsData: []
    }
  },
  methods: {
    getAllTransportLine() {
      transportLine.getAllTransportLine().then(data => {
        this.transportLineData = data.data
      })
    },
    getAllTransportTrips() {
      transportTrips.getTransportTrips().then(data => {
        this.transportTripsData = data.data
      })
    }
  },
  mounted() {
    this.getAllTransportLine()
    this.getAllTransportTrips()
  }
}
</script>

<style scoped>

</style>
